package drds.data_propagate.driver.packets;

import com.google.common.base.Preconditions;
import drds.data_propagate.common.utils.ToStringStyle;

@SuppressWarnings("PacketWithHeaderPacket")
public abstract class AbstractPacket implements Packet {

    protected HeaderPacket headerPacket;

    protected AbstractPacket() {
    }

    protected AbstractPacket(HeaderPacket headerPacket) {
        setHeaderPacket(headerPacket);
    }

    public HeaderPacket getHeaderPacket() {
        return headerPacket;
    }

    public void setHeaderPacket(HeaderPacket headerPacket) {
        Preconditions.checkNotNull(headerPacket);
        this.headerPacket = headerPacket;
    }

    public String toString() {
        return ToStringStyle.toString(this);
    }

}
